package com.tanker.common.utils; 

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/** 
 * @Author  zg 
 * @Date 2011-9-29
 * @Comments 
 */
public class CommonConstants {
	//====================================  正则   ====================================
	/** Email地址正则表达式 */
	public static final String REGULAR_EMAIL = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
	/** 用户名校验的正则表达式(字母、数字、下划线、中文) */
	public static final String REGULAR_USER_NAME = "^[a-zA-Z0-9_\u4e00-\u9fa5]+$";
	/** 格式(id为数字)：“id1,id2,id3”  */
	public static final String REGULAR_IDS_FORMAT = "\\d+(,\\d+)*";
	/** 数字  */
	public static final String REGULAR_NUMERAL = "\\d+";
	//====================================  session key   ====================================
	
	public static final String ENCRYPT_KEY = "nvkzlY32Y3lJRweEv+9SmEyFLh64MflotJUQAQ==";
	
	//====================================  date & time format   ====================================
	/** 日期/时间格式  "yyyy-MM-dd HH:mm:ss,SSS" */
//	public static final SimpleDateFormat DATETIME_FULL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
	//解决SimpleDateFormat线程不安全的问题，151010 huangjing
	private static final SimpleDateFormat DATETIME_FULL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
    public static String DATETIME_FULL_FORMAT(Date date) {
    	synchronized(DATETIME_FULL){
    		return DATETIME_FULL.format(date);
    	}
    }
    public static Date DATETIME_FULL_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_FULL){
    		return DATETIME_FULL.parse(date);
    	}
    }
	
	/** 日期/时间格式  "yyyyMMddHHmmssSSS" */
//	public static final SimpleDateFormat DATETIME_FULL_STR = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    private static final SimpleDateFormat DATETIME_FULL_STR = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    public static String DATETIME_FULL_STR_FORMAT(Date date) {
    	synchronized(DATETIME_FULL_STR){
    		return DATETIME_FULL_STR.format(date);
    	}
    }
    public static Date DATETIME_FULL_STR_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_FULL_STR){
    		return DATETIME_FULL_STR.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyyy-MM-dd HH:mm:ss" */
//	public static final SimpleDateFormat DATETIME_SEC = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    private static final SimpleDateFormat DATETIME_SEC = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static String DATETIME_SEC_FORMAT(Date date) {
    	synchronized(DATETIME_SEC){
    		return DATETIME_SEC.format(date);
    	}
    }
    public static Date DATETIME_SEC_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_SEC){
    		return DATETIME_SEC.parse(date);
    	}
    }
	/** 日期/时间格式  "yyyy-MM-dd HH:mm" */
    private static final SimpleDateFormat DATETIME_MIN = new SimpleDateFormat("yyyy-MM-dd HH:mm");
    public static String DATETIME_MIN_FORMAT(Date date) {
    	synchronized(DATETIME_MIN){
    		return DATETIME_MIN.format(date);
    	}
    }
    public static Date DATETIME_MIN_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_MIN){
    		return DATETIME_MIN.parse(date);
    	}
    }  
	/** 日期/时间格式  "yyyyMMddHHmmss" */
//	public static final SimpleDateFormat DATETIME_SEC_STR = new SimpleDateFormat("yyyyMMddHHmmss");
    private static final SimpleDateFormat DATETIME_SEC_STR = new SimpleDateFormat("yyyyMMddHHmmss");
    public static String DATETIME_SEC_STR_FORMAT(Date date) {
    	synchronized(DATETIME_SEC_STR){
    		return DATETIME_SEC_STR.format(date);
    	}
    }
    public static Date DATETIME_SEC_STR_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_SEC_STR){
			return DATETIME_SEC_STR.parse(date);
    	}
    }
    
    
    
    
	/** 日期/时间格式  "yyyy-MM-dd" */
//	public static final SimpleDateFormat DATE = new SimpleDateFormat("yyyy-MM-dd");
    private static final SimpleDateFormat DATE = new SimpleDateFormat("yyyy-MM-dd");
    public static String DATE_FORMAT(Date date) {
    	synchronized(DATE){
    		return DATE.format(date);
    	}
    }
    public static Date DATE_PARSE(String date) throws ParseException{
    	synchronized(DATE){
    		return DATE.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyyy" */
//	public static final SimpleDateFormat DATE_YEAR = new SimpleDateFormat("yyyy");
    private static final SimpleDateFormat DATE_YEAR = new SimpleDateFormat("yyyy");
    public static String DATE_YEAR_FORMAT(Date date) {
    	synchronized(DATE_YEAR){
    		return DATE_YEAR.format(date);
    	}
    }
    public static Date DATE_YEAR_PARSE(String date) throws ParseException{
    	synchronized(DATE_YEAR){
    		return DATE_YEAR.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyyyMM" */
//	public static final SimpleDateFormat DATE_YEAR_MONTH = new SimpleDateFormat("yyyyMM");
    private static final SimpleDateFormat DATE_YEAR_MONTH = new SimpleDateFormat("yyyyMM");
    public static String DATE_YEAR_MONTH_FORMAT(Date date) {
    	synchronized(DATE_YEAR_MONTH){
    		return DATE_YEAR_MONTH.format(date);
    	}
    }
    public static Date DATE_YEAR_MONTH_PARSE(String date) throws ParseException{
    	synchronized(DATE_YEAR_MONTH){
    		return DATE_YEAR_MONTH.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyyyMMdd" */
//	public static final SimpleDateFormat DATE_STR = new SimpleDateFormat("yyyyMMdd");
    private static final SimpleDateFormat DATE_STR = new SimpleDateFormat("yyyyMMdd");
    public static String DATE_STR_FORMAT(Date date) {
    	synchronized(DATE_STR){
    		return DATE_STR.format(date);
    	}
    }
    public static Date DATE_STR_PARSE(String date) throws ParseException{
    	synchronized(DATE_STR){
    		return DATE_STR.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyMMdd" */
//	public static final SimpleDateFormat DATE_SHORT_STR = new SimpleDateFormat("yyMMdd");
    private static final SimpleDateFormat DATE_SHORT_STR = new SimpleDateFormat("yyMMdd");
    public static String DATE_SHORT_STR_FORMAT(Date date) {
    	synchronized(DATE_SHORT_STR){
    		return DATE_SHORT_STR.format(date);
    	}
    }
    public static Date DATE_SHORT_STR_PARSE(String date) throws ParseException{
    	synchronized(DATE_SHORT_STR){
    		return DATE_SHORT_STR.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyMMdd" */
//	public static final SimpleDateFormat DATE_SHORT_YEAR_MONTH = new SimpleDateFormat("yyMM");
    private static final SimpleDateFormat DATE_SHORT_YEAR_MONTH = new SimpleDateFormat("yyMM");
    public static String DATE_SHORT_YEAR_MONTH_FORMAT(Date date) {
    	synchronized(DATE_SHORT_YEAR_MONTH){
    		return DATE_SHORT_YEAR_MONTH.format(date);
    	}
    }
    public static Date DATE_SHORT_YEAR_MONTH_PARSE(String date) throws ParseException{
    	synchronized(DATE_SHORT_YEAR_MONTH){
    		return DATE_SHORT_YEAR_MONTH.parse(date);
    	}
    }
    
	/** 日期/时间格式  "MMdd" */
//	public static final SimpleDateFormat DATE_NO_YEAR = new SimpleDateFormat("MMdd");
    private static final SimpleDateFormat DATE_NO_YEAR = new SimpleDateFormat("MMdd");
    public static String DATE_NO_YEAR_FORMAT(Date date) {
    	synchronized(DATE_NO_YEAR){
    		return DATE_NO_YEAR.format(date);
    	}
    }
    public static Date DATE_NO_YEAR_PARSE(String date) throws ParseException{
    	synchronized(DATE_NO_YEAR){
    		return DATE_NO_YEAR.parse(date);
    	}
    }
    
	/** 获得月份  "MM" */
//	public static final SimpleDateFormat DATE_NO_MONTH = new SimpleDateFormat("MM");
    private static final SimpleDateFormat DATE_NO_MONTH = new SimpleDateFormat("MM");
    public static String DATE_NO_MONTH_FORMAT(Date date) {
    	synchronized(DATE_NO_MONTH){
    		return DATE_NO_MONTH.format(date);
    	}
    }
    public static Date DATE_NO_MONTH_PARSE(String date) throws ParseException{
    	synchronized(DATE_NO_MONTH){
    		return DATE_NO_MONTH.parse(date);
    	}
    }
    
	/** 日期/时间格式  "HHmmss" */
//	public static final SimpleDateFormat TIME_SEC_STR = new SimpleDateFormat("HHmmss");
    private static final SimpleDateFormat TIME_SEC_STR = new SimpleDateFormat("HHmmss");
    public static String TIME_SEC_STR_FORMAT(Date date) {
    	synchronized(TIME_SEC_STR){
    		return TIME_SEC_STR.format(date);
    	}
    }
    public static Date TIME_SEC_STR_PARSE(String date) throws ParseException{
    	synchronized(TIME_SEC_STR){
    		return TIME_SEC_STR.parse(date);
    	}
    }
    
	/** 日期/时间格式  "HHmmss" */
//	public static final SimpleDateFormat TIME_HH_MM = new SimpleDateFormat("HH:mm");
    private static final SimpleDateFormat TIME_HH_MM = new SimpleDateFormat("HH:mm");
    public static String TIME_HH_MM_FORMAT(Date date) {
    	synchronized(TIME_HH_MM){
    		return TIME_HH_MM.format(date);
    	}
    }
    public static Date TIME_HH_MM_PARSE(String date) throws ParseException{
    	synchronized(TIME_HH_MM){
    		return TIME_HH_MM.parse(date);
    	}
    }
    
	/** 日期/时间格式  "HHmmss" */
//	public static final SimpleDateFormat TIME_H_M = new SimpleDateFormat("HHmm");
    private static final SimpleDateFormat TIME_H_M = new SimpleDateFormat("HHmm");
    public static String TIME_H_M_FORMAT(Date date) {
    	synchronized(TIME_H_M){
    		return TIME_H_M.format(date);
    	}
    }
    public static Date TIME_H_M_PARSE(String date) throws ParseException{
    	synchronized(TIME_H_M){
    		return TIME_H_M.parse(date);
    	}
    }
    
	/** 日期/时间格式  "HH:mm:ss" */
//	public static final SimpleDateFormat TIME_SEC = new SimpleDateFormat("HH:mm:ss");
    private static final SimpleDateFormat TIME_SEC = new SimpleDateFormat("HH:mm:ss");
    public static String TIME_SEC_FORMAT(Date date) {
    	synchronized(TIME_SEC){
    		return TIME_SEC.format(date);
    	}
    }
    public static Date TIME_SEC_PARSE(String date) throws ParseException{
    	synchronized(TIME_SEC){
    		return TIME_SEC.parse(date);
    	}
    }
	
	/** 日期格式  "yyyy/MM/dd" */
//	public static final SimpleDateFormat DATE_INSUR = new SimpleDateFormat("yyyy/MM/dd");
    private static final SimpleDateFormat DATE_INSUR = new SimpleDateFormat("yyyy/MM/dd");
    public static String DATE_INSUR_FORMAT(Date date) {
    	synchronized(DATE_INSUR){
    		return DATE_INSUR.format(date);
    	}
    }
    public static Date DATE_INSUR_PARSE(String date) throws ParseException{
    	synchronized(DATE_INSUR){
    		return DATE_INSUR.parse(date);
    	}
    }
	
//	public static final SimpleDateFormat DATE_FULL_CHN = new SimpleDateFormat("MM月dd日HH时mm分");
    private static final SimpleDateFormat DATE_FULL_CHN = new SimpleDateFormat("MM月dd日HH时mm分");
    public static String DATE_FULL_CHN_FORMAT(Date date) {
    	synchronized(DATE_FULL_CHN){
    		return DATE_FULL_CHN.format(date);
    	}
    }
    public static Date DATE_FULL_CHN_PARSE(String date) throws ParseException{
    	synchronized(DATE_FULL_CHN){
    		return DATE_FULL_CHN.parse(date);
    	}
    }
    /** 日期/时间格式  "yyyy/MM/dd HH:mm" */
    private static final SimpleDateFormat DATETIME_DAY_MIN = new SimpleDateFormat("yyyy/MM/dd HH:mm");
    public static String DATETIME_DAY_MIN_FORMAT(Date date) {
    	synchronized(DATETIME_MIN){
    		return DATETIME_DAY_MIN.format(date);
    	}
    }
    public static Date DATETIME_DAY_MIN_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_DAY_MIN){
    		return DATETIME_DAY_MIN.parse(date);
    	}
    }  
//	public static final SimpleDateFormat DATE_WED_RENT_FULL_CHN = new SimpleDateFormat("MM月dd日 HH:mm");
    private static final SimpleDateFormat DATE_WED_RENT_FULL_CHN = new SimpleDateFormat("MM月dd日 HH:mm");
    public static String DATE_WED_RENT_FULL_CHN_FORMAT(Date date) {
    	synchronized(DATE_WED_RENT_FULL_CHN){
    		return DATE_WED_RENT_FULL_CHN.format(date);
    	}
    }
    public static Date DATE_WED_RENT_FULL_CHN_PARSE(String date) throws ParseException{
    	synchronized(DATE_WED_RENT_FULL_CHN){
    		return DATE_WED_RENT_FULL_CHN.parse(date);
    	}
    }
    
    private static final SimpleDateFormat DATE_WEEK_RENT_FULL_CHN = new SimpleDateFormat("MM月dd日 EEEE HH:mm");
    public static String DATE_WEEK_RENT_FULL_CHN_FORMAT(Date date) {
    	synchronized(DATE_WEEK_RENT_FULL_CHN){
    		return DATE_WEEK_RENT_FULL_CHN.format(date);
    	}
    }
    public static Date DATE_WEEK_RENT_FULL_CHN_PARSE(String date) throws ParseException{
    	synchronized(DATE_WEEK_RENT_FULL_CHN){
    		return DATE_WEEK_RENT_FULL_CHN.parse(date);
    	}
    }
    
    //Sun Mar 26 00:00:00 CST 2017 
//	   SimpleDateFormat sdf1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
    private static final SimpleDateFormat DATE_ORI_FULL_UK = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
    public static String DATE_ORI_FULL_UK_FORMAT(Date date) {
    	synchronized(DATE_ORI_FULL_UK){
    		return DATE_ORI_FULL_UK.format(date);
    	}
    }
    public static Date DATE_ORI_FULL_UK_PARSE(String date) throws ParseException{
    	synchronized(DATE_ORI_FULL_UK){
    		return DATE_ORI_FULL_UK.parse(date);
    	}
    }
    
//	public static final SimpleDateFormat DATE_WED_REVERT_FULL_CHN = new SimpleDateFormat("HH:mm");
    private static final SimpleDateFormat DATE_WED_REVERT_FULL_CHN = new SimpleDateFormat("HH:mm");
    public static String DATE_WED_REVERT_FULL_CHN_FORMAT(Date date) {
    	synchronized(DATE_WED_REVERT_FULL_CHN){
    		return DATE_WED_REVERT_FULL_CHN.format(date);
    	}
    }
    public static Date DATE_WED_REVERT_FULL_CHN_PARSE(String date) throws ParseException{
    	synchronized(DATE_WED_REVERT_FULL_CHN){
    		return DATE_WED_REVERT_FULL_CHN.parse(date);
    	}
    }
    
	/**日期格式  "yyyy年MM月 */
//	public static final SimpleDateFormat DATE_YEAR_MONTH_CN = new SimpleDateFormat("yyyy年MM月");
    private static final SimpleDateFormat DATE_YEAR_MONTH_CN = new SimpleDateFormat("yyyy年MM月");
    public static String DATE_YEAR_MONTH_CN_FORMAT(Date date) {
    	synchronized(DATE_YEAR_MONTH_CN){
    		return DATE_YEAR_MONTH_CN.format(date);
    	}
    }
    public static Date DATE_YEAR_MONTH_CN_PARSE(String date) throws ParseException{
    	synchronized(DATE_YEAR_MONTH_CN){
    		return DATE_YEAR_MONTH_CN.parse(date);
    	}
    }
    
	/**日期格式  "yyyy年MM月dd日 */
    private static final SimpleDateFormat DATE_YEAR_MONTH_DAY_CN = new SimpleDateFormat("yyyy年MM月dd日");
    public static String DATE_YEAR_MONTH_DAY_CN_FORMAT(Date date) {
    	synchronized(DATE_YEAR_MONTH_DAY_CN){
    		return DATE_YEAR_MONTH_DAY_CN.format(date);
    	}
    }
    public static Date DATE_YEAR_MONTH_DAY_CN_PARSE(String date) throws ParseException{
    	synchronized(DATE_YEAR_MONTH_DAY_CN){
    		return DATE_YEAR_MONTH_DAY_CN.parse(date);
    	}
    }
    
	/** 日期/时间格式  "yyyyMMddHHmm" */
//	public static final SimpleDateFormat DATETIME_SEC_STR = new SimpleDateFormat("yyyyMMddHHmmss");
    private static final SimpleDateFormat DATETIME_YEAR_MONTH_DAY = new SimpleDateFormat("yyyyMMddHHmm");
    public static String DATETIME_YEAR_MONTH_DAY(Date date) {
    	synchronized(DATETIME_YEAR_MONTH_DAY){
    		return DATETIME_YEAR_MONTH_DAY.format(date);
    	}
    }
    public static Date DATETIME_YEAR_MONTH_DAY(String date) throws ParseException{
    	synchronized(DATETIME_YEAR_MONTH_DAY){
			return DATETIME_YEAR_MONTH_DAY.parse(date);
    	}
    }
    //时间格式“yyyy.MM.dd”
    private static final SimpleDateFormat DATETIME_SEC_MINUTE_STR = new SimpleDateFormat("yyyy.MM.dd");
    public static String DATETIME_SEC_MINUTE_STR_FORMAT(Date date) {
    	synchronized(DATETIME_SEC_MINUTE_STR){
    		return DATETIME_SEC_MINUTE_STR.format(date);
    	}
    }
    public static Date DATETIME_SEC_MINUTE_STR_PARSE(String date) throws ParseException{
    	synchronized(DATETIME_SEC_MINUTE_STR){
    		return DATETIME_SEC_MINUTE_STR.parse(date);
    	}
    }
    
    /**
     * 返回两个日期之前的所有日期
     * @param dBegin
     * @param dEnd
     * @return
     */
    public static <T> List<T> findDates(Date dBegin, Date dEnd,int returnType) { 
    	List<String> dateStr = new ArrayList<String>(); 
        List<Date> lDate = new ArrayList<Date>();  
        lDate.add(dBegin);  
        Calendar calBegin = Calendar.getInstance();  
        // 使用给定的 Date 设置此 Calendar 的时间    
        calBegin.setTime(dBegin);  
        Calendar calEnd = Calendar.getInstance();  
        // 使用给定的 Date 设置此 Calendar 的时间    
        calEnd.setTime(dEnd);  
        // 测试此日期是否在指定日期之后    
        while (dEnd.after(calBegin.getTime())) {  
            // 根据日历的规则，为给定的日历字段添加或减去指定的时间量    
            calBegin.add(Calendar.DAY_OF_MONTH, 1);  
            lDate.add(calBegin.getTime()); 
        }
        if(returnType==1 ){
       	for (int j = 0; j < lDate.size(); j++) {
    		 dateStr.add( CommonConstants.DATE_STR_FORMAT(lDate.get(j)) );
			}
          	return (List<T>) dateStr;
        }
          return (List<T>) lDate;
    }  
	/**
	 * 判断时间是否在时间段内
	 * 
	 * @param date
	 *            当前时间 yyyy-MM-dd HH:mm:ss
	 * @param strDateBegin
	 *            开始时间 00:00:00
	 * @param strDateEnd
	 *            结束时间 00:05:00
	 * @return
	 */
	public static boolean isInDate(Date date, String strDateBegin,
			String strDateEnd) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String strDate = sdf.format(date);
		// 截取当前时间时分秒
		int strDateH = Integer.parseInt(strDate.substring(11, 13));
		int strDateM = Integer.parseInt(strDate.substring(14, 16));
		int strDateS = Integer.parseInt(strDate.substring(17, 19));
		// 截取开始时间时分秒
		int strDateBeginH = Integer.parseInt(strDateBegin.substring(0, 2));
		int strDateBeginM = Integer.parseInt(strDateBegin.substring(3, 5));
		int strDateBeginS = Integer.parseInt(strDateBegin.substring(6, 8));
		// 截取结束时间时分秒
		int strDateEndH = Integer.parseInt(strDateEnd.substring(0, 2));
		int strDateEndM = Integer.parseInt(strDateEnd.substring(3, 5));
		int strDateEndS = Integer.parseInt(strDateEnd.substring(6, 8));
		if ((strDateH >= strDateBeginH && strDateH <= strDateEndH)) {  
			// 当前时间小时数在开始时间和结束时间小时数之间
			if (strDateH > strDateBeginH && strDateH < strDateEndH) {
				return true;
				// 当前时间小时数等于开始时间小时数，分钟数在开始和结束之间
			} else if (strDateH == strDateBeginH && strDateM >= strDateBeginM
					&& strDateM <= strDateEndM) {
				return true;
				// 当前时间小时数等于开始时间小时数，分钟数等于开始时间分钟数，秒数在开始和结束之间
			} else if (strDateH == strDateBeginH && strDateM == strDateBeginM
					&& strDateS >= strDateBeginS && strDateS <= strDateEndS) {
				return true;
			}
			// 当前时间小时数大等于开始时间小时数，等于结束时间小时数，分钟数小等于结束时间分钟数
			else if (strDateH >= strDateBeginH && strDateH == strDateEndH
					&& strDateM <= strDateEndM) {
				return true;
				// 当前时间小时数大等于开始时间小时数，等于结束时间小时数，分钟数等于结束时间分钟数，秒数小等于结束时间秒数
			} else if (strDateH >= strDateBeginH && strDateH == strDateEndH
					&& strDateM == strDateEndM && strDateS <= strDateEndS) {
				return true;
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
	/** 限行起始时间*/
	public static final String LIMIT_TIME1 = "20170410000000";
	/** 限行第一阶段截止时间*/
	public static final String LIMIT_TIME2 = "20170710000000";
	/** 限行第二阶段截止时间*/
	public static final String LIMIT_TIME3 = "20171009000000";	
	/** 限行第三阶段截止时间*/
	public static final String LIMIT_TIME4 = "20180108000000";
	/** 限行第四阶段截止时间*/
	public static final String LIMIT_TIME5 = "20180409000000";
	/** 北京单双号限行截止日期*/
	public static final String LIMIT_TIME6 = "20150904000000";
	/** 限行第四阶段截止时间*/
	public static final String LIMIT_TIME7 = "20170709000000";
	/**神马车辆判断来源，trans_ext表*/
	public static final String DISCOUPON_TRANS_EXT_SOURCE="2";
	/**神马车辆判断来源，car_tags表*/
	public static final String DISCOUPON_CAR_TAGS_SOURCE="1";
	
	public static void main(String[] args) {
		Date validDate;
		try {
			validDate = CommonConstants.DATE_STR_PARSE("20170221");
			
			int v = Integer.valueOf("20170221");
			
			String now = CommonConstants.DATE_STR_FORMAT(new Date());
			
			int n = Integer.valueOf(now);
			
//			System.out.println("validDate="+validDate);
//			System.out.println("now="+CommonConstants.DATE_STR_PARSE(now));
			
//			if (validDate.before(CommonConstants.DATE_STR_PARSE(now))) {
			if(v < n){
				System.out.println("过期啦");
			}else{
				System.out.println("正常啦");
			}
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		try {
			long rentTime = 20170223211500l;
			long revertTime = 20170224084500l;

			Date rentDate = CommonConstants.DATETIME_SEC_STR_PARSE(String.valueOf(rentTime));
			Date revertDate = CommonConstants.DATETIME_SEC_STR_PARSE(String.valueOf(revertTime));
			
			boolean rentFlag1 = CommonConstants.isInDate(rentDate, "22:01:01", "23:59:59");
			boolean rentFlag2 = CommonConstants.isInDate(rentDate, "00:00:00", "08:59:59");
			
			boolean revertFlag1 = CommonConstants.isInDate(revertDate, "22:01:01", "23:59:59");
			boolean revertFlag2 = CommonConstants.isInDate(revertDate, "00:00:00", "08:59:59");
			
			if(rentFlag1 || rentFlag2 || revertFlag1 || revertFlag2){
				System.out.println("抱歉，22：00 ~ 09：00 无法提供取送车服务，请调整用车时间");
			}else{
				System.out.println("OKOK");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
 
